package com.xiaochen.baidu.common.design.combination.engine.impl;

import com.xiaochen.baidu.common.design.combination.engine.EngineBase;
import com.xiaochen.baidu.common.design.combination.logic.LogicFilter;
import com.xiaochen.baidu.common.design.combination.engine.model.aggregates.TreeRich;
import com.xiaochen.baidu.common.design.combination.engine.model.vo.EngineResult;
import com.xiaochen.baidu.common.design.combination.engine.model.vo.TreeNode;

import java.util.Map;

/**
 * @author xc
 * @date 2025/10/11/15:55
 * @desc
 */
public class TreeEngineHandle<T> extends EngineBase<T> {
    
    public TreeEngineHandle(Map<String, LogicFilter<T>> stringLogicFilterMap) {
        super(stringLogicFilterMap);
    }

    @Override
    public EngineResult<T> process(Long treeId, TreeRich treeRich, Map<String, T> decisionMatter) {
        //决策过程
        TreeNode<T> treeNode = engineDecisionMaker(treeRich, treeId, decisionMatter);
        //决策结果
        return new EngineResult<T>(true, treeId, treeNode.getTreeNodeId(), treeNode.getNodeValue());
    }
}
